package com.lavida.project.system.review.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lavida.common.utils.security.ShiroUtils;
import com.lavida.framework.aspectj.lang.annotation.Log;
import com.lavida.framework.aspectj.lang.enums.BusinessType;
import com.lavida.framework.web.controller.BaseController;
import com.lavida.framework.web.page.TableDataInfo;
import com.lavida.project.system.review.domain.Review;
import com.lavida.project.system.review.service.ReviewService;
import com.lavida.project.system.user.domain.User;
import com.lavida.project.system.user.service.IUserService;

@Controller
@RequestMapping("/system/review")
public class ReviewController extends BaseController{
	
	private String prefix = "system/review";
	@Autowired
	private ReviewService reviewService;
	@Autowired
	private IUserService userService;
	
	@RequiresPermissions("empatten:review:view")
	@RequestMapping()
	public String goods(ModelMap mmap) {
		User user  = ShiroUtils.getSysUser();
		User user1 = userService.selectUserById(user.getUserId());
		mmap.put("user", user1);
		return prefix + "/review";
	}
	@RequiresPermissions("empatten:review:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(Review review,HttpServletRequest request) {
		startPage();
		List<Review> selectReview = reviewService.selectReview(review);
		return getDataTable(selectReview);
	}
}
